package com.yiqi.lottery.feature.lottery.view.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.widget.LinearLayout;

import java.util.List;

/**
 * LIJUWEN
 *
 * @email yiyayiyayaoljw@gmail.com
 * @date 2017/9/20 15:39
 */
public class MyFragmentAdapter extends FragmentPagerAdapter {
    private List<Fragment> list;

    private String[] titles = {"中大奖故事", "中大奖技巧"};
    FragmentManager fragmentManager;

    public MyFragmentAdapter(FragmentManager fm, List<Fragment> fragments) {
        super(fm);
        this.list = fragments;
        this.fragmentManager = fm;

    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    //重写这个方法，将设置每个Tab的标题
    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
